package org.jivesoftware.smackx.provider;

import org.jivesoftware.smack.packet.IQ;
import org.jivesoftware.smack.provider.IQProvider;
import org.jivesoftware.smack.util.PacketParserUtils;
import org.jivesoftware.smackx.packet.DiscoverInfo;
import org.jivesoftware.smackx.packet.DiscoverInfo.Identity;
import org.xmlpull.v1.XmlPullParser;

public class DiscoverInfoProvider
  implements IQProvider
{
  public IQ parseIQ(XmlPullParser paramXmlPullParser)
    throws Exception
  {
    DiscoverInfo localDiscoverInfo = new DiscoverInfo();
    int i = 0;
    String str1 = "";
    String str2 = "";
    String str3 = "";
    String str4 = "";
    localDiscoverInfo.setNode(paramXmlPullParser.getAttributeValue("", "node"));
    while (true)
    {
      do
      {
        int j;
        label165: 
        do
          while (true)
          {
            while (true)
            {
              while (true)
              {
                if (i != 0)
                  return localDiscoverInfo;
                j = paramXmlPullParser.next();
                if (j != 2)
                  break label165;
                if (!(paramXmlPullParser.getName().equals("identity")))
                  break;
                str1 = paramXmlPullParser.getAttributeValue("", "category");
                str2 = paramXmlPullParser.getAttributeValue("", "name");
                str3 = paramXmlPullParser.getAttributeValue("", "type");
              }
              if (!(paramXmlPullParser.getName().equals("feature")))
                break;
              str4 = paramXmlPullParser.getAttributeValue("", "var");
            }
            localDiscoverInfo.addExtension(PacketParserUtils.parsePacketExtension(paramXmlPullParser.getName(), paramXmlPullParser.getNamespace(), paramXmlPullParser));
          }
        while (j != 3);
        if (paramXmlPullParser.getName().equals("identity"))
        {
          DiscoverInfo.Identity localIdentity = new DiscoverInfo.Identity(str1, str2);
          localIdentity.setType(str3);
          localDiscoverInfo.addIdentity(localIdentity);
        }
        if (paramXmlPullParser.getName().equals("feature"))
          localDiscoverInfo.addFeature(str4);
      }
      while (!(paramXmlPullParser.getName().equals("query")));
      i = 1;
    }
  }
}